package cn.ppool.xmlmapper.builder.parse.model.base;

import cn.ppool.xmlmapper.builder.MapperBuilder;
import cn.ppool.xmlmapper.builder.parse.worker.WorkStackRecord;
import cn.ppool.xmlmapper.builder.xml.XNode;
import lombok.Getter;
import lombok.Setter;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public abstract class BaseEntryBO extends BaseBo {

    /**
     * 建造模型
     */
    public abstract void buildEntityModel();

    /**
     * 生成代码
     */
    public abstract String complieEntity(final Map<String, Object> allVar, Map<String, Object> sqlVar, StringBuilder sql);


    @Getter
    private final XNode currentNode;
    @Getter
    private final XNode rootNode;
    @Getter
    private final Method entryMethod;
    @Getter
    protected BaseEntryBO redirectEntry;
    @Getter
    protected Annotation funAnt;          // 注解
    @Getter
    protected List<BaseFuncBO> sqlList;
    @Getter
    private final String id;
    @Getter
    private final WorkStackRecord workRecord;
    @Getter
    protected String originSql;
    @Getter
    protected String fun;


    public BaseEntryBO(MapperBuilder mapperBuilder, final XNode rootNode, XNode currentNode, final Method method, final String id) {
        super(mapperBuilder);
        this.currentNode = currentNode;
        this.rootNode = rootNode;
        this.entryMethod = method;
        sqlList = new ArrayList<>();
        this.id = id;
        this.workRecord = new WorkStackRecord();
    }


}
